
    ##############################################################################################
    ### Figure 1 - R code


    T1 <- 92
    T2 <- 114
    T <- length(T1:T2)  # number of congresses
    year.odd <- seq(from=1971, to=2016, by=2)

    Outputs <- read.csv("Figure1_Data.csv", header=T)
    dim(Outputs)
    names(Outputs)
    

    postscript("Figure1.eps", height=10, width=8, horizontal=F)
    par(mfrow = c(4,3), mar = c(0,0,0,0), oma = c(3,4,0,0), mgp=c(1.5, 0, 0), xpd=NA, tck=-0.007)  #c(bottom, left, top, right)
    for (t in c(92)){
    Est_Dem <- subset(Outputs, congress==t & party==100)
    plot(Est_Dem$mean_out, Est_Dem$X1980_Adj.Score, type='p', col='blue', xlim=c(-5,5), ylim=c(0,100), main="", xlab="", ylab="Ajusted LCV Score", xaxt="n")
    legend('top', legend=c(paste(t, "th Senate - ", year.odd[t-(T1-1)], sep="")), col=c('black'), cex=1)
    Est_Rep <- subset(Outputs, congress==t & party==200)
    points(Est_Rep$mean_out, Est_Rep$X1980_Adj.Score, type='p', pch="+", col='red')
    segments(-5, 100, 5, 0, lty=1)
    box()
    }
    for (t in c(93,94)){
    Est_Dem <- subset(Outputs, congress==t & party==100)
    plot(Est_Dem$mean_out, Est_Dem$X1980_Adj.Score, type='p', col='blue', xlim=c(-5,5), ylim=c(0,100), main="", xlab="", ylab="", yaxt="n", xaxt="n", axes=F)    #title(main=paste(t, "th Senate - ", year.odd[t-(T1-1)], sep=""), font.main=1, cex=0.7)
    legend('top', legend=c(paste(t, "th Senate - ", year.odd[t-(T1-1)], sep="")), col=c('black'), cex=1)
    Est_Rep <- subset(Outputs, congress==t & party==200)
    points(Est_Rep$mean_out, Est_Rep$X1980_Adj.Score, type='p', pch="+", col='red')
    segments(-5, 100, 5, 0, lty=1)
    box()
    }
    for (t in c(96)){
    Est_Dem <- subset(Outputs, congress==t & party==100)
    plot(Est_Dem$mean_out, Est_Dem$X1980_Adj.Score, type='p', col='blue', xlim=c(-5,5), ylim=c(0,100), main="", xlab="", ylab="Ajusted LCV Score", xaxt="n")
    legend('top', legend=c(paste(t, "th Senate - ", year.odd[t-(T1-1)], sep="")), col=c('black'), cex=1)
    Est_Rep <- subset(Outputs, congress==t & party==200)
    points(Est_Rep$mean_out, Est_Rep$X1980_Adj.Score, type='p', pch="+", col='red')
    segments(-5, 100, 5, 0, lty=1)
    box()
    }    
    for (t in c(98)){
    Est_Dem <- subset(Outputs, congress==t & party==100)
    plot(Est_Dem$mean_out, Est_Dem$X1980_Adj.Score, type='p', col='blue', xlim=c(-5,5), ylim=c(0,100), main="", xlab="", ylab="", yaxt="n", xaxt="n", axes=F)
    legend('top', legend=c(paste(t, "th Senate - ", year.odd[t-(T1-1)], sep="")), col=c('black'), cex=1)
    Est_Rep <- subset(Outputs, congress==t & party==200)
    points(Est_Rep$mean_out, Est_Rep$X1980_Adj.Score, type='p', pch="+", col='red')
    segments(-5, 100, 5, 0, lty=1)
    box()
    }
    for (t in c(101)){
    Est_Dem <- subset(Outputs, congress==t & party==100)
    plot(Est_Dem$mean_out, Est_Dem$X1980_Adj.Score, type='p', col='blue', xlim=c(-5,5), ylim=c(0,100), main="", xlab="", ylab="", yaxt="n", xaxt="n", axes=F)
    legend('top', legend=c(paste(t, "th Senate - ", year.odd[t-(T1-1)], sep="")), col=c('black'), cex=1)
    Est_Rep <- subset(Outputs, congress==t & party==200)
    points(Est_Rep$mean_out, Est_Rep$X1980_Adj.Score, type='p', pch="+", col='red')
    segments(-5, 100, 5, 0, lty=1)
    box()
    }
    for (t in c(103)){
    Est_Dem <- subset(Outputs, congress==t & party==100)
    plot(Est_Dem$mean_out, Est_Dem$X1980_Adj.Score, type='p', col='blue', xlim=c(-5,5), ylim=c(0,100), main="", xlab="", ylab="Ajusted LCV Score", xaxt="n")
    legend('top', legend=c(paste(t, "th Senate - ", year.odd[t-(T1-1)], sep="")), col=c('black'), cex=1)
    Est_Rep <- subset(Outputs, congress==t & party==200)
    points(Est_Rep$mean_out, Est_Rep$X1980_Adj.Score, type='p', pch="+", col='red')
    segments(-5, 100, 5, 0, lty=1)
    box()
    }    
    for (t in c(105,107)){
    Est_Dem <- subset(Outputs, congress==t & party==100)
    plot(Est_Dem$mean_out, Est_Dem$X1980_Adj.Score, type='p', col='blue', xlim=c(-5,5), ylim=c(0,100), main="", xlab="", ylab="",  yaxt="n", xaxt="n", axes=F)
    legend('top', legend=c(paste(t, "th Senate - ", year.odd[t-(T1-1)], sep="")), col=c('black'), cex=1)
    Est_Rep <- subset(Outputs, congress==t & party==200)
    points(Est_Rep$mean_out, Est_Rep$X1980_Adj.Score, type='p', pch="+", col='red')
    segments(-5, 100, 5, 0, lty=1)
    box()
    }    
    for (t in c(109)){
    Est_Dem <- subset(Outputs, congress==t & party==100)
    plot(Est_Dem$mean_out, Est_Dem$X1980_Adj.Score, type='p', col='blue', xlim=c(-5,5), ylim=c(0,100), main="", xlab="IRT Estimate", ylab="Ajusted LCV Score")
    legend('top', legend=c(paste(t, "th Senate - ", year.odd[t-(T1-1)], sep="")), col=c('black'), cex=1)
    Est_Rep <- subset(Outputs, congress==t & party==200)
    points(Est_Rep$mean_out, Est_Rep$X1980_Adj.Score, type='p', pch="+", col='red')
    segments(-5, 100, 5, 0, lty=1)
    box()
    }    
    for (t in c(110,111)){
    Est_Dem <- subset(Outputs, congress==t & party==100)
    plot(Est_Dem$mean_out, Est_Dem$X1980_Adj.Score, type='p', col='blue', xlim=c(-5,5), ylim=c(0,100), main="", xlab="IRT Estimate", ylab="", yaxt="n")
    legend('top', legend=c(paste(t, "th Senate - ", year.odd[t-(T1-1)], sep="")), col=c('black'), cex=1)
    Est_Rep <- subset(Outputs, congress==t & party==200)
    points(Est_Rep$mean_out, Est_Rep$X1980_Adj.Score, type='p', pch="+", col='red')
    segments(-5, 100, 5, 0, lty=1)
    box()
    }    
    dev.off()

